#
# This file is a part of the open-eBackup project.
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file, You can obtain one at
# http://mozilla.org/MPL/2.0/.
#
# Copyright (c) [2024] Huawei Technologies Co.,Ltd.
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#

from pydantic import BaseModel, Field


class MetaDataInfo(BaseModel):
    backup_id: str = Field(None, description="任务ID", alias="backupId")
    backup_type: int = Field(None, description="备份类型", alias="backupType")
    backup_index_id: str = Field(None, description="backup_key", alias="backupIndexId")
    version: str = Field(None, description="集群版本", alias="version")
    backup_dir: str = Field(None, description="备份新增目录", alias="backupDir")
    backup_file: str = Field(None, description="备份新增文件", alias="backupFile")
    copy_time: str = Field(None, description="备份副本时间", alias="copyTime")
    node_info: list = Field(None, description="集群主备信息", alias="nodeInfo")
    begin_time: int = Field(None, description="begin time", alias='beginTime')
    end_time: int = Field(None, description="end time", alias='endTime')


class NodeInfo(BaseModel):
    node_ip: str = Field(None)
    node_role: str = Field(None, description="主节点/备节点")
    status: str = Field(None, description="节点状态")
    node_name: str = Field(None, description="节点名称")
    instance_name: str = Field(None, description="实例名称")


class BackupJobPermission(BaseModel):
    user: str = Field(None, description="数据库操作用户")
    group: str = Field(None, description="数据库操作所属组")
    file_mode: str = Field(None, description="权限", alias="fileMode")
